<?php $this->load->view("common/page_header");?>
	<?php $this->load->view("common/top_banner");?>
	<?php $this->load->view("common/header");?>
	
	<div id="body_main">
		<div class="search_top">
			<?php $this->load->view("common/top_login_button");?>
			<div class="title"><?php echo $group['title'];?></div>
			<div class="left" style="margin-left:600px;margin-top:-67px;"><?php echo $this->load->view("common/message")?></div>
			<div class="clear"></div>
		</div>
		<div class="top_border margin_top15">
			<div class="arrow_up" style="left:50px"></div>
		</div>
		
		<div id="body_content" class="group_view white_bg">		
			<div class="sidebar">
				<div class="group_admin">
					<?php if(!empty($group['logo'])) {?>
						<img class="profile" src="/img/uploads/<?php echo $group['logo']?>" />
					<?php } else {?>
					<img class="profile" src="/img/user.png" />
					<?php }?>
					<div class="intro">
						组长：<?php 
						if (!empty($group_admins)) {
							foreach ($group_admins as $group_admin) {
								echo '<a href="/user/show?user_id=' . $group_admin['user_id'] . '">' . $group_admin['nickname'] . '</a>&nbsp;';
							}
						}
						?><br />
						组员：<?php echo $group['member_count']?>人
					</div>
					<div class="clear"></div>
				</div>
				<div class="group_intro margin_top10">
					<?php echo nl2br($group['introduction']);?>
					<div class="group_enroll">
						<?php if (!$is_founder) {?>
							<a class="green_button" href="/group/<?php echo ( $is_member ? "quit" : "join");?>?group_id=<?php echo $group['id'];?>"><?php echo ( $is_member ? "退出" : "加入");?>小组</a>
						<?php }?>
						<?php if($is_group_admin) {?>
						<a class="green_button" href="/group/admin?group_id=<?php echo $group['id'];?>">管理小组</a>
						<?php }?>
						<?php if (!empty($feedback)) {?>
						<?php $this->load->view("common/message");?>
						<?php }?>
						<div class="clear"></div>
					</div>
				</div>
				<div class="new_members">
					<div class="title">最近加入的小组成员</div>
					<ul class="all_memebers margin_top10">
						<?php for($i = 0, $n = count($group_users); $i < $n; $i ++) { ?>
						<li class="member"><a href="/user/show?user_id=<?php echo $group_users[$i]['user_id']?>" class="underline"><?php echo $group_users[$i]['nickname']?></a></li>
						<?php } ?>
					</ul>
				</div>
			</div>
			<div class="story_list">
				<div class="margin_left10">
					<a class="green_button" href="/group/newthread?group_id=<?php echo $group['id']?>">+发言</a>
					<div class="clear"></div>
				</div>
				<div class="margin_top15 margin_left10">小组议事厅</div>
				<table class="a_table margin_top15 text_left_table" width="100%">
					<tr>
						<th width="345">主题</th>
						<th width="60">作者</th>
						<th width="42">回复</th>
						<th width="98">回应时间</th>
					</tr>
					<?php if (!empty($threads)) {?>
					<?php foreach($threads as $thread) { ?>
					<tr>
						<td><?php echo $thread['is_top'] ? "[置顶]&nbsp;" : '';?><?php echo $thread['digest'] ? "[精华]&nbsp;" : '';?><a href="/group/forum_view?thread_id=<?php echo $thread['id']?>" class="<?php echo $thread['highlight'] ? "highlight" : '';?>"><span class="top"></span><?php echo $thread['title'];?></a></td>
						<td><a href="/user/show?user_id=<?php echo $thread['created_by']?>"><?php echo $thread['nickname'];?></a></td>
						<td><?php echo $thread['reply_count'];?></td>
						<td><?php echo substr($thread['created'], 0 ,10);?></td>
					</tr>
					<?php } ?>
					<?php }?>
				</table>
				<?php $this->load->view("common/page_controller"); ?>
			</div>
			<div class="clear"></div>
		</div>
		
		<?php $this->load->view("common/footer");?>		
		
		<p class="center">Page rendered in {elapsed_time} seconds</p>
	</div>
<script type="text/javascript">
$(document).ready(function(){
	$("#register_button").colorbox({iframe:true, innerWidth:556, innerHeight:320, close:'关闭'});
	$("#login_button").colorbox({iframe:true, innerWidth:390, innerHeight:180, close:'关闭'});
});	
</script>
<?php $this->load->view("common/page_footer");?>
